﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Default.aspx.vb" Inherits="Assignment4._Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 156px;
        }
        .style3
        {
            width: 69px;
        }
        .style4
        {
            width: 99px;
        }
        .style6
        {
            width: 15px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <h1>Home Page</h1>
    <asp:Label ID="lblWelcome" runat="server" Text=""></asp:Label>
    <br />
    <br />
    <br />

    <table class="style1">
        <tr>
            <td class="style3">
                Sort By:</td>
            <td class="style2">
&nbsp;<asp:DropDownList ID="drpSortBy" runat="server" AutoPostBack="True">
                    <asp:ListItem Value="0">Latest</asp:ListItem>
                    <asp:ListItem Value="1">High Rating</asp:ListItem>
                    <asp:ListItem Value="2">Easiest</asp:ListItem>
                    <asp:ListItem Value="3">Hardest</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td class="style4">
                Choose Tag:</td>
            <td>
                <asp:DropDownList ID="drpTags" runat="server" AutoPostBack="True" Height="21px" 
                    Width="99px" AppendDataBoundItems="True" DataSourceID="SqlDataSourceTags" 
                    DataTextField="TagName" DataValueField="TagId">
                    <asp:ListItem Value="-1">None</asp:ListItem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSourceTags" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:learningConnectionString %>" 
                    ProviderName="<%$ ConnectionStrings:learningConnectionString.ProviderName %>" 
                    SelectCommand="SELECT TagId, TagName, UserId, Visible FROM Tags WHERE (Visible = True)">
                </asp:SqlDataSource>
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
    
    <br />
    <br />

   
    
    <asp:ListView ID="lstQuizzes"  runat="server" GroupItemCount="3">

       <LayoutTemplate>
      <table>
         <tr>
            <td>
               <table style=" border: 1px Solid  #628695;"  cellpadding="5" width="860px">
                  <asp:PlaceHolder runat="server" ID="groupPlaceHolder"></asp:PlaceHolder>
               </table>
            </td>
         </tr>
      </table>
   </LayoutTemplate>

   <GroupTemplate>
      <tr>
         <asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
      </tr>
   </GroupTemplate>


        <ItemTemplate>
        <td>
       <table>
        <tr>
            <td rowspan="3">
               <a href='<%# "QuizOverview.aspx?quizId="+ Eval("QuizId").ToString() %>'> <asp:Image ID="imgQuiz" CssClass="commentsavatar"  ImageUrl='<%# Eval("QuizPicture") %>' runat="server" /></a>
                </td>
            <td>
                <asp:Label ID="lblQuizName" runat="server" Text='<%# Eval("QuizName") %>'></asp:Label>
                </td>
        </tr>
         <tr>
            <td>
                <asp:Literal ID="ltrStars" Text='<%# getStars(Eval("QuizId")) %>' runat="server"></asp:Literal>
            </td>
         </tr>
        <tr>
            <td>
                <asp:LinkButton ID="lnkQuiz" PostBackUrl='<%#"~/QuizOverview.aspx?quizId="+ Eval("QuizId").ToString() %>' runat="server">Read More</asp:LinkButton>
            </td>
        </tr>
        <tr>
         <td>&nbsp;</td>
        </tr>
        <tr>
        <td>&nbsp;</td>
        </tr>
        </td>
       </table>
        </ItemTemplate>
    
     
      
       
    </asp:ListView>
    <table>
    <tr>
      <td>
          <asp:DataPager ID="dtpPager" PagedControlID="lstQuizzes" PageSize="6" runat="server">
              <Fields>
                 
                  <asp:NumericPagerField />
                 
              </Fields>
          </asp:DataPager>
      </td>
    </tr>
    </table>
    <br />
    
</asp:Content>

